package com.toe.business.webapi.controller;


import com.toe.business.service.BusinessAlbumService;
import com.toe.business.service.BusinessInformationService;
import com.toe.common.restful.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.spring.web.json.Json;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 陶涛
 * @since 2022-07-19
 */
@RestController
@RequestMapping("/webapi/business-album")
@Api(tags = "商家模块")
public class BusinessAlbumController {
    @Autowired
    private BusinessAlbumService albumService;
    @Autowired
    private BusinessInformationService informationService;

    @GetMapping("/de-InfoById")
    @ApiOperation("商家图片")
    public JsonResult<List<String>> albumUrl(Long id){
        List<String> albumList = albumService.albumUrl(id);
        List<String> coverUrl = informationService.businessCover(id);

        return albumList != null && !albumList.isEmpty() ?
                JsonResult.ok(albumList) : JsonResult.ok(coverUrl);
    }
}

